import request from "../utils/request";
import config from '../config'

export function login(data) {
    return request.post("/admin/login", data)
}
//查询分类列表接口
export function getCategoryList() {
    return request.get('/category/findAll')
}
//查询单个分类接口
export function getCategory(params) {
    return request.get('/category/findOne', { params })
}
//新增分类接口
export function addCategory(data) {
    return request.post('/category/add', data)
}
//修改分类接口
export function editCategory(data) {
    return request.post('/category/update', data)
}
//删除分类接口
export function delCategory(data) {
    return request.get('/category/delete?id=' + data.id)
}
//修改密码接口
export function changeAdminPassword(data) {
    return request.post('/setting/changePassword', data)
}
//修改头像接口
export function changeAdminAvatar(params) {
    return request.post('/setting/changeAvatar', params)
}
//更新图片接口
export function uploadPictureURL() {
    return config.baseURL + 'upload/picture'
}
//新增商品接口
export function addGoods(data) {
    return request.post('/goods/add', data)
}
//查找商品列表接口
export function getGoodsList() {
    return request.get('/goods/findAll')
}
//查找商品分页列表接口
export function getGoodsOnePage(params) {
    return request.get('/goods/findOnePage', { params })
}
//查找单个商品接口
export function getGoods(params) {
    return request.get('/goods/findOne', { params })
}
//修改商品及相册接口
export function editGoods(data) {
    return request.post('/goods/update', data)
}
//删除商品接口
export function delGoods(data) {
    return request.get('/goods/delete?id=' + data.id)
}
//用户信息接口
export function getAdmin() {
    return request.get('/admin/admin')
}